package com.example.springboot.pattern.proxy.cglib;


import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/3/8
 **/
public class TargetInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {

        System.out.println("调用前");

        Object result = methodProxy.invokeSuper(o, objects);

        System.out.println("调用后 " + result);

        return result;
    }
}
